3. generic device 3

所以我们刚刚完成了为四种状态创建状态机,禁用、启用、启用和禁用,正如您在我们的计数中所记得的那样,我们还在这里添加了状态,这意味着设备实际上没有以任何方式工作。
So we just finished to create our state machine for the four states, the disabled, enabling, enabled and disabling, as you recall in our numeration, we also added over here and of state, meaning that the device is actually not working in any way.

因此,它强制激活保持静止,并且设备不移动也不对任何请求做出反应。
So it is forcing the activation to stay still and the device to not move and to not react to any requests.

所以现在,我们实际上应该看看这个北部的含义以及如何在我们的通用设备中处理它。
So right now, we shall actually look at what this upstate's means and how this will be handled in our generic device.

所以在这里,我们将在这里添加它实际上足够的状态。
So over here, we will add it actually enough state over here.

这意味着设备不会对请求做出反应,也不会改变状态。
That means that the device is not reacting to requests and it is not changing state.

这对于处理紧急情况也很有用。
This will also be useful in handling emergencies.

因此,在这里,我们将添加该输入和其他输入,这些输入实际上将用于启用我们的通用设备功能块,这意味着退出该状态。
So over here, we will add that and other input that will actually be used to enable our generic device function block that means to get out of the state.

因此,在这里,我将添加一个输入,该输入将调用启用通用设备和可行设备。
So over here, I will add an input that will call enable generic device and viable.

而这实际上是用来启用FBI的。
And this is actually used to enable the FBI.

因此,在这种状态下,如果我们从另一个状态开始,在收到并启用通用设备请求之前,我们实际上不会执行任何操作。
So and in this state, if we start from another state, we will actually do nothing until we receive and enable generic device requests.

所以这意味着我们应该真正开始使用状态机。
So it means that we should actually start using the state machine.

因此,如果我们实际上使启用通用设备等于 true,那么我们将根据启动设备所需的状态进入启用或禁用状态。
So if we actually have the enable generic device equal to true, then we shall either go into an enabling or disabling state according to what is the state that we need to to start our device.

因此,如果我们已经有启用设备的请求,我会写它。
So I will write it if we already have a request for the enabling of the device.

因此,设备通常被调用通过,我们将移动到等于启用的设备状态。
So the device commonly called through, we shall move to the device state equal to enabling.

否则我们将进入禁用状态。
Otherwise we shall go to the disabling state.

例如,如果我们要进入禁用状态并且设备已经被禁用,我们将直接跳回到禁用状态。
If, for instance, we are going to the disabling state and the device is already disabled, we will just jump back in the disabled state directly.

相反,如果我们在设备启用后实际上对启用设备的请求做出反应,那么它会自动进入这两种状态之一。
If instead we are actually reacting to a request of enabling the device once the devices are enabled, will it will automatically get to one of these two states.

所以实际上,禁用和启用状态是我们可以看到的设备的稳定状态,同时它们启用和禁用我们的过渡状态。
So actually, the disabled and the enable the state are what we can see are stable states for our device while they are enabling and disabling our transition states.

因此,当 this 输入恢复有效时,我们几乎就完成了简单的端到端句柄。
So we are almost done with just simply end to end handle when the this input goes back to force.

因此,无论我们是否启用了通用设备,我们都可以在我们的案例功能之外进行操作。
So we could just right outside of our function of our case, if we have and if we have not enabled generic devices.

所以有人禁用了设备,我们应该回到状态。
So someone as disabled the device, we should go back to the state.

所以设备状态等于UFF。
So device state is equal to UFF.

好的,我们的状态机现在已经完成了。
OK, so our state machine is complete right now.

我们需要做的是根据我们的状态机实际处理传感器和执行器。
What we need to do is to actually handle the sensors and actuators according to our state machine.

Zirkel,我们实际上没有与任何执行器交互,我们甚至没有定义一些执行器。
Zirkel, we don't have we didn't actually interact with any actuators, we didn't even define some.

我们使用这个内部反馈,并且我们实际上应该定义这个内部启用禁用反馈是什么。
And we use this internal feedback's and we should actually define what this internal enabling disable feedbacks are.

因此,我们将在这里添加我们的输入。
So we shall add in our inputs over here.

让我们通过 Bollani 输入将它们添加到此处,以便在传感器存在时实际链接它们。
Let's add them right here through Bollani inputs to actually link the sensors if they are presence.

因此,我们将启用一个设备,该传感器是螺栓变量,而设备禁用的传感器又是一个体积变量。
So we will have one device enabled, the sensor that is a bolt on variable and a device disabled sensor that is again a volume variable.

另一方面。
On the other side.

我们实际上还需要一些输出连接到执行器。
We would actually need also some outputs to be connected to the actuators.

所以我们会有一个.
So we will have an.

Enable启用设备执行器,执行器即是大胆可行,启用灯抱歉,再次禁用设备执行器,一栓不可行。
Enable enabled device actuator, actuator that is a bold and viable and enable the light sorry, disable device actuator again, a bolt unviable.

在这里,我们实际上将根据反馈类型将这些变量的值映射到内部启用和禁用反馈中。
Over here we shall actually map the value of these variables according to the feedback type into the internal enable and disable feedback.

然后我们实际上应该根据我们所处的状态和我们拥有的激活类型来映射启用和禁用执行器的值。
And then we should actually map the values of the enable and disable actuators according to the state we are in and according to the activation type that we have.

因此,在这里我们将实际处理反馈的映射。
So over here we shall actually handle the mapping of the feedbacks.

因此,我将在这里写一条评论,即反馈映射,我们实际上将根据我们的反馈类型进行选择,因此我可以在这里为反馈类型创建一个案例,并且这不是状态机,这就像如果反馈等于其他东西,则使反馈设备等于某些东西,依此类推。
And so I will write a comment that is the feedback mapping over here and we shall actually carry out our selection according to our feedback type, so I can create over here a case for the feedback type of and that this is not a state machine and this is simply like doing a feedback device equal to something if feedback is equal to something else and so on.

因此,在这里我们实际上有四种情况:有反馈设备和没有反馈。
So over here we will have actually four cases if the feedback devices and no feedback.

如果反馈类型是单个可用反馈并且如果设备是单个禁用反馈。
If the feedback type is a single able feedback and if the device is a single single disable feedback.

或者如果是双重反馈。
Or if it is a double feedback.

好的,让我们从最后一个开始,实际上最简单的就是更容易的,因为我们有实际的传感器。
OK, so let's start from the last one that is actually the easy is the easier one because we have the actual sensors.

因此,既然我们需要映射我们的内部并启用和禁用反馈,我们就应该这样做。
So since we need to map our internal and enable and disable feedback, we shall.

在这里,我们的内部可见反馈等于我们将拥有的真实传感器。
Right over here that our internal visible feedback is equal to the real sensor that we will have.

因此,它将等于设备禁用的传感器,内部启用反馈将等于设备启用的传感器。
So it will be equal to the device disabled sensor and the internal enable feedback will be equal to the device enabled sensor.

所以这是最简单的一个。
So this is the easiest one.

现在让我们看看没有反馈,所以当我们收到一些设备实际上被禁用的反馈时,我们的内部设备反馈将等于什么?
And let's now look at the no feedback, so when we will have some some feedback that the device is actually disabled, so our internal device feedback would be equal to what?

好吧,由于我们没有传感器,所以正如我所说,我们将依赖状态机和计时器的状态。
Well, since we don't have a sensor, we will have as as I said, to rely on states of the state machine and timers.

所以当我们处于禁用状态时,我们实际上就处于禁用状态。
So we will be disabled actually when we are in the disabled state.

所以我可以在这里打开圆括号,看看如果我们的设备状态实际上等于禁用,我们将被禁用。
So I can open round brackets over here and see that we will be disabled if our devices state is actually equal to disabled.

或者另一个条件是我们处于禁用状态并且我们的超时已经过期。
Or another condition is that we are in a disabling state and our time out has expired.

因此,如果我们处于无反馈情况,我们将使用此条件来实际处理状态机内的转换。
So this if we are in this no feedback situation, we will use this condition to actually handle the transition within the state machine.

所以该状态等于禁用,我们有大胆可行的超时。
So the state is equal to disabling and we have the timeout bold and viable.

那么这是什么意思?
So what does this mean?

这意味着,如果我们处于残疾状态,我们仍然是残疾。
This means that if we are where disabled, we are still disabled.

有一次,当我们在这个州这里时,我们认为该设备已被禁用,因为我们没有其他反馈,没有反馈。
Once when we are over here in the state, we consider the device to be disabled because we have no other feedback, no feedback.

否则,如果我们被禁用,我们将等待超时来考虑设备被禁用。
Otherwise, if we are disabled, we will wait for the time out to consider the device disabled.

所以,如果我们到了这里,我们就开始。
So if we are over here, we will start.

非常抱歉,在禁用状态下,我们会启动定时器,根据定时器,一旦超时,该值就会变为通过。
We are very sorry in the disabling state, we will start the timer and this value will become through once the timeout becomes through, according to the timer.

同样,对于启用反馈也可以说同样的事情,所以我写的,我们将编写相同的东西,这样如果设备状态已启用或设备状态等于启用,我们的内部启用反馈将等于 true。
Again, the same thing can be said for the enable feedback, so I writing, we will write the same things so our internal enables feedback will be equal to true if the device state is enabled or if the device state is equal to enabling.

我们到了超时时间。
And we reached the time out.

因此,通过这种方式,我们实际上使用了一些专门基于超时的传感器。
So in this way we actually used some sensor based exclusively on timeouts.

现在对于这种糖来说,我们只有一个传感器。
Now for this sugar is this way we have only one sensor.

我们将有一个介于反馈和双重反馈之间的混合解决方案。
We will have a hybrid solution between the feedback and the double feedback.

因此,如果我们有一个启用的反馈,则禁用的反馈将在此处超时时给出。
So if we have a single enabled feedback, the disabled feedback will be given by the time out over here.

因此,我将复制并粘贴此内容,并启用真实传感器将给出的反馈,如下所示。
So I will copy and paste this and enable feedback will be given by the real sensor like this.

在门口,我们将添加一个单独的禁用反馈。
And in a doorway we will have added a single for the single disable feedback we will have.

真正可见的反馈是这行代码,对于初始反馈,我们实际上必须依赖计时器。
The real visible feedback from that is this line of code and for the initial feedback, we will actually have to rely on the timer.

所以我们将这一行复制到这里。
So we copy this line over here.

所以我们在这里所做的实际上是将值映射到这里。
So what we did over here is actually map the values over here.

我的意思是,这些是分号而不是两个点。
I mean, these the semicolon instead of the two points.

因此,在这里,我们实际上已经根据我们拥有的反馈类型将传感器映射到我们在状态机中使用的内部传感器。
So over here, we actually have mapped our sensors into the internal sensor that we use in our state machines according to the type of feedback that we have a.

因此,我们还需要针对这种情况做同样的事情,因此我们需要根据州的情况来映射此驱动。
So we will also need to do the same thing for the situation, so we will need to map this actuation according to the state's.

所以在这里,让我们为我们的通用设备添加另一个,呃,另一个部分。
So over here, let's add another another, uh, another section for our generic device.

在这里我会写。
And over here I will write.

这是我们进行执行器映射的部分。
This is the part where we carry out the actuators mapping.

在这里,我将对我推迟的采集类型执行另一个案例说明。
And over here, I will carry out another case instruction for the acquisition type that I put off, so.

我们实际上能够寻找这些举措的价值,所以如果抱歉,让我们回到功能上。
We were actually able to look for our values of the initiatives, so if sorry, let's get back to the function.

听着,如果我们没有学费,我们就什么也做不了。
Look, if we have no tuition, we shall do nothing.

我们甚至不会使用 Vereide 来查看输出,因为它们不存在。
We shall not even Vereide to the output because they are not there.

实际上,设备失去了意义,如果我们只有一个驱动,我们只需编写启用的设备执行器,因为禁用的设备不会被使用,并且当我们处于启用或启用状态。
And actually the device loses meaning instead, if we have a single actuation, we shall simply write the enabled device actuator since the disable one will not be used and we will need the for the enabled device actuator to be through when we are either in the enabled or enabling state.

例如,我们正在从之前的位置看活塞,如果我们正在启用或已启用,则意味着我们正在前进或我们实际上已经到了终点。
For instance, we are looking at the piston from before we shall, if we are enabling or enabled, meaning that we are moving forward or we are actually at the end.

我们需要激励才能成为真实的。
We need to be actuation to be true.

相反,如果我们处于disabled状态或者处于disabled状态,我们需要注意是false。
Instead, if we are in the disabled state or in the disabling state, we need to attention to be false.

因此,如果我们的实际设备状态等于启用或设备状态等于启用,我们只需纠正启用的设备就必须为 true。
So we simply right that our enabled device will need to be true if we have the actual device state equal to enabling or the device state equal to enabled.

好吧,这意味着在其他州它只是错误的。
OK, this means that in the other states it will simply be false.

这就是单次启动和双次启动的情况。
So this is it for the single actuation, for the double activation.

我们实际上必须写一些不同的东西,因为如果你还记得的话,让我们也上网一次,在双激活设备的可视化上看到这个,进行下载,我会告诉你我的意思。
We actually have to write something different because if you remember, let's also let's go on line for once and see this on the visualisation of a double activation device, carry out a download and I will show you what I mean.

因此,正如我所说,在我们启用或启用之前的第一个单一驱动,我们将保持这一点直到完成。
So over here, as I said, the first single actuation before we are enabling or enabled, we shall maintain this to through.

如果我们正在禁用或禁用,我们将保持此强制而不是在这里。
If we are disabling or disable, we shall maintain this to force instead of over here.

实际上,只有当我们移动活塞时,我们才会启用其中之一。
We shall actually enable one of this to only if we are moving the piston.

如果活塞静止,我们不需要启用其中之一。
If the piston is still, we don't need to enable one of this.

所以在这里,我们实际上处于禁用状态,而在启用状态下这两者都应为假。
So over here, which we are actually in the what is the disabled state and both of this shall be false in the enabling state.

这必须是真的。
This one needs to be true.

当设备启用时,实际上这个需要再次变为 false。
And when the device is enabled, actually this one needs to become false again.

所以他们启用激活,需要通过名称中的所有启用阶段。
So they enable activation, needs to be through all in the name, the enabling phase.

并且以类似的方式,仅在像这样的禁用阶段,禁用激活才需要为真。
And in a similar way, the disable activation needs to be true only in disabling phase like this.

因此,让我们离线,我需要在这里写的是,对于双重驱动,仅当设备处于启用状态时,启用的设备执行器才需要为真。
So let's go offline and what I need to write over here is that for a double actuation, the enabled device actuator needs to be true only when the device is enabling state it is enabling.

并且,仅当设备正在禁用时,禁用设备执行器才需要为 true。
And the device, the to disable device actuator needs to be true only if the device is disabling.

因此,当设备状态启用或禁用时,我们不需要任何驱动,我们只需要在此过渡阶段打开驱动。
So we don't need any actuation when the device state is enabled or disabled, we need an actuation turned on only during this transition phase is.

这里的另一件事,抱歉,我将删除此评论,您需要研究的另一件事实际上是这样一个事实:在该州或通过在该州以这种方式写下此内容,所有指控都将被迫强制。
Another thing over here, sorry, I will remove this comment and another thing that you need to look into is actually the fact that in the state or by writing this in this way in the state, all the accusation will be forced to force.

这是一件好事,因为设备无法工作。
And this is something good because the device isn't working.

我们不想要任何东西来驱动。
We don't want anything to turn the actuation to.

这样,当设备实际上没有从该输入启用时,它就不会移动。
So in this way, when the device is not actually enabled from this input, it will not move.

它将仍然在原来的地方。
It will be still where it is.

好吧,实际上,我们已经成功编写了通用设备的大部分部分,我们只需要添加后面关于诊断和管理错误的部分。
OK, so actually, we we managed to write most of the part of our generic devices, and we just need to add the later on the part regarding false for the diagnosis and management.

但在这里,我们实际上有一个功能块,应该能够处理所有这些不同类型的活塞。
But over here, we actually have a function block that should be able to handle all this different kinds of piston's.

因此,在下一个视频中,我们实际上将在主程序中编写一些内容,并且我们将开始将这些通用设备实现到主程序中,以处理所有这七种不同类型的活塞。
So in the next video, we will actually write something in our main program and we will start implementing these generic devices into the into the main program to handle all these seven different kinds of piston's.